package com.cjzuji.rental.controller.order;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cjzuji.rental.dao.OrderContractDao;
import com.cjzuji.rental.dao.OrderBillDao;
import com.cjzuji.rental.dao.OrderDao;
import com.cjzuji.rental.dao.OrderUserDao;
import com.cjzuji.rental.mapper.OrderMapper;
import com.cjzuji.rental.pojo.Orders;
import com.cjzuji.rental.pojo.RequestHeard;
import com.cjzuji.rental.service.PassService;
import com.cjzuji.rental.mapper.RequestMapper;

import com.cjzuji.rental.service.YouPinService;
import com.cjzuji.rental.util.Tool;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("/order/youpingpass")
@Api(tags = "优品租用中订单")
public class PassController {
    @Autowired
    PassService passService;
    @Autowired
    RequestMapper requestMapper;
    private static final Logger logger = LoggerFactory.getLogger(PassController.class);
    @GetMapping("/getPassInfo")
    public List<Map<String, Object>> getPassList(){

        //从数据库获取
        QueryWrapper<RequestHeard> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",1);
        RequestHeard requestHeard = requestMapper.selectOne(queryWrapper);
        String accesstoken = requestHeard.getAccesstoken();
        String authorization = requestHeard.getAuthorization();
        List<Map<String, Object>> result = passService.getPassList(accesstoken, authorization);
        return result;
    }

}
